package com.jytc.framework.po;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * FwPermission entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "fw_permission")
public class FwPermission implements java.io.Serializable {

	// Fields

	private Integer permissionId;
	private String permissionName;
	private Integer permissionType;
	private String permissionUrl;
	private Integer permissionSort;
	private Integer parentPermissionId;
	private Integer systemType;
	private Set<FwRolePermission> fwRolePermissions = new HashSet<FwRolePermission>(
			0);

	// Constructors

	/** default constructor */
	public FwPermission() {
	}
	
	public FwPermission(Integer permissionId) {
		this.permissionId = permissionId;
	}

	/** minimal constructor */
	public FwPermission(String permissionName, Integer permissionType,
			String permissionUrl, Integer permissionSort, Integer systemType) {
		this.permissionName = permissionName;
		this.permissionType = permissionType;
		this.permissionUrl = permissionUrl;
		this.permissionSort = permissionSort;
		this.systemType = systemType;
	}

	/** full constructor */
	public FwPermission(String permissionName, Integer permissionType,
			String permissionUrl, Integer permissionSort,
			Integer parentPermissionId, Integer systemType,
			Set<FwRolePermission> fwRolePermissions) {
		this.permissionName = permissionName;
		this.permissionType = permissionType;
		this.permissionUrl = permissionUrl;
		this.permissionSort = permissionSort;
		this.parentPermissionId = parentPermissionId;
		this.systemType = systemType;
		this.fwRolePermissions = fwRolePermissions;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "permission_id", unique = true, nullable = false)
	public Integer getPermissionId() {
		return this.permissionId;
	}

	public void setPermissionId(Integer permissionId) {
		this.permissionId = permissionId;
	}

	@Column(name = "permission_name", nullable = false, length = 50)
	public String getPermissionName() {
		return this.permissionName;
	}

	public void setPermissionName(String permissionName) {
		this.permissionName = permissionName;
	}

	@Column(name = "permission_type", nullable = false)
	public Integer getPermissionType() {
		return this.permissionType;
	}

	public void setPermissionType(Integer permissionType) {
		this.permissionType = permissionType;
	}

	@Column(name = "permission_url", nullable = false, length = 250)
	public String getPermissionUrl() {
		return this.permissionUrl;
	}

	public void setPermissionUrl(String permissionUrl) {
		this.permissionUrl = permissionUrl;
	}

	@Column(name = "permission_sort", nullable = false)
	public Integer getPermissionSort() {
		return this.permissionSort;
	}

	public void setPermissionSort(Integer permissionSort) {
		this.permissionSort = permissionSort;
	}

	@Column(name = "parent_permission_id")
	public Integer getParentPermissionId() {
		return this.parentPermissionId;
	}

	public void setParentPermissionId(Integer parentPermissionId) {
		this.parentPermissionId = parentPermissionId;
	}

	@Column(name = "system_type", nullable = false)
	public Integer getSystemType() {
		return this.systemType;
	}

	public void setSystemType(Integer systemType) {
		this.systemType = systemType;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fwPermission")
	public Set<FwRolePermission> getFwRolePermissions() {
		return this.fwRolePermissions;
	}

	public void setFwRolePermissions(Set<FwRolePermission> fwRolePermissions) {
		this.fwRolePermissions = fwRolePermissions;
	}

}